package com.tiange.controller;

import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.tiange.contant.Activities;
import com.tiange.factory.CashContext;

@RestController
public class StrategyController {
	
	Activities[] actis = {Activities.NORMAL, Activities.FULL300BACK100, Activities.REBATE80};

	@RequestMapping("/getResult/{type}")
	public String getResult(@PathVariable Integer type) {
		
		CashContext context = new CashContext(actis[type]);
		
		double total = 0d;
		total = context.getResult(111 * 56);
		
		return "单价：111，数量：56，总共：" + total;
	}
}
